/**
 * 
 */
package com.app.mvc.action;

import javax.servlet.http.HttpServletRequest;

import org.apache.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;

import com.app.commons.cache.ICacheService;
import com.app.service.ICornDBService;
import com.app.service.IUserService;
import com.app.service.vo.UserVo;

/**
 * @author yuxk
 *
 */
@Controller
@RequestMapping(value="/login")//如果使用了类级别的地址则具体执行地址必须为地址全名不可以使用通配符
public class WelcomeAction {

	
	private static Logger logger  = Logger.getLogger(WelcomeAction.class);
	
	@Autowired
	private ICornDBService corndbservice;
	/**
	 * 
	 */
	public WelcomeAction() {
		// TODO Auto-generated constructor stub
		logger.info("com.app.mvc.action.WelcomeAction loader");
	}
	@Autowired
	private ICacheService<UserVo> service;
	
	@Autowired
	private IUserService userSerivce;
	/**
	 * 注入admin超级用户
	 * @param username
	 * @param passwor
	 * @return
	 */
	@RequestMapping(value="/admin.form")
	public String welcome(HttpServletRequest request)
	{
			
			logger.info("admin login...");
			return "/logins/admin/login-admin";
		
		
	}
	/**
	 * 获取数据库中所有的点位信息
	 * @param request
	 * @return
	 */
	@RequestMapping(value="/user.form")
	public String userlogin(HttpServletRequest request)
	{
		logger.info("普通用户登录");
		return "/logins/user/login-user";
	}
	/**
	 * 获取数据库中所有的点位信息
	 * @param request
	 * @return
	 */
	@RequestMapping(value="/layout.form")
	public String layout(HttpServletRequest request)
	{
		request.getSession().removeAttribute("uservo");
		return "/welcome";
	}
	
	public ICacheService<UserVo> getService() {
		return service;
	}
	public void setService(ICacheService<UserVo> service) {
		this.service = service;
	}
	public IUserService getUserSerivce() {
		return userSerivce;
	}
	public void setUserSerivce(IUserService userSerivce) {
		this.userSerivce = userSerivce;
	}

	public ICornDBService getCorndbservice() {
		return corndbservice;
	}

	public void setCorndbservice(ICornDBService corndbservice) {
		this.corndbservice = corndbservice;
	}

	
	
	
}
